<?php
	header("Content-type:text/html;charset=utf-8");
	
	//1.用户登录数据库
	//mysql_connect("服务器地址","用户名","密码");
	$conn = mysql_connect("localhost","root","root");
	if($conn){
		// echo "连接成功"." "."<br>";
		//2.选择需要连接的数据库
		mysql_select_db("nanzhijiamu");
		//3.操作 
		$result = mysql_query("select * from goods",$conn);
		//循环获取游标所对应的每一行的记录
		echo $result;
		while($obj = mysql_fetch_assoc($result)){
			echo $obj["goodsId"].",".$obj["goodsName"].
			",".$obj["goodsImg"].",".$obj["goodsPrice"];
		}
		//4.关闭连接
		mysql_close($conn);
	}
	// $obj["goodsId"]. " ". 
?>